package com.cy.factory;

import com.cy.service.RemoteProviderService;

import com.sun.org.apache.regexp.internal.RE;
import feign.hystrix.FallbackFactory;

import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class RemoteFallbackFactory implements FallbackFactory<RemoteProviderService> {
//    private static Logger log = LoggerFactory.getLogger(RemoteProviderService.class);
    @Override
    public RemoteProviderService create(Throwable throwable) {
        log.error("用户服务调用失败：{}",throwable.getMessage());
        /*return new RemoteProviderService() {
            @Override
            public String echoMessage(String msg) {
                return "服务忙，稍等片刻再访问";
            }
        };*/

        return (String msg)-> {return "服务忙，稍等片刻再访问";};

    }

}
